/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: CourseAggregaImpl.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/17 下午3:18
 * LastModified: 2020/03/17 15:18:17
 */

package com.qolome.knowledge.design.pattern.iterator.demo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Qolome
 * @version V1.0
 * @Description 课程集合
 * @date 2020年 03月17日 15:18:41
 */
public class CourseAggregaImpl implements ICourseAggrega{

    private List<Course> courseList;

    CourseAggregaImpl(){
        this.courseList = new ArrayList<>();
    }

    @Override
    public void add(Course course) {

        courseList.add(course);
    }

    @Override
    public void remove(Course course) {
        courseList.remove(course);
    }

    @Override
    public Iterator<Course> iterator() {
        return new IteratorImpl(courseList);
    }
}
